//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    // banner
    imgUrls: [
      'http:\/\/www.360zn.xin\/image\/1.jpg',
      'http:\/\/www.360zn.xin\/image\/1.jpg',
      'http:\/\/www.360zn.xin\/image\/1.jpg'
    ],
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000, //  滑动动画时长1s

    // 新品上架
    goodsItems: [
      {
        offerid: 0,
        name: '木耳',
        url: 'bill',
        imageurl: 'http://www.360zn.xin/image/muer.png',
        newprice: "45.00",
        oldprice: "50.00",
        shiyong:120,
      },
      {
        offerid: 0,
        name: '木耳',
        url: 'bill',
        imageurl: 'http://www.360zn.xin/image/muer.png',
        newprice: "45.00",
        oldprice: "50.00",
        shiyong: 120,
      },
      {
        offerid: 0,
        name: '木耳',
        url: 'bill',
        imageurl: 'http://www.360zn.xin/image/muer.png',
        newprice: "45.00",
        oldprice: "50.00",
        shiyong: 120,
      },
      {
        offerid: 0,
        name: '木耳',
        url: 'bill',
        imageurl: 'http://www.360zn.xin/image/muer.png',
        newprice: "45.00",
        oldprice: "50.00",
        shiyong: 120,
      },
      {
        offerid: 0,
        name: '木耳',
        url: 'bill',
        imageurl: 'http://www.360zn.xin/image/muer.png',
        newprice: "45.00",
        oldprice: "50.00",
        shiyong: 120,
      },
      {
        offerid: 0,
        name: '木耳',
        url: 'bill',
        imageurl: 'http://www.360zn.xin/image/muer.png',
        newprice: "45.00",
        oldprice: "50.00",
        shiyong: 120,
      },
      {
        offerid: 0,
        name: '木耳',
        url: 'bill',
        imageurl: 'http://www.360zn.xin/image/muer.png',
        newprice: "45.00",
        oldprice: "50.00",
        shiyong: 120,
      }
    ],  
  },
      //下拉刷新
    onPullDownRefresh: function () {
    wx.showNavigationBarLoading() //在标题栏中显示加载
    //模拟加载
    setTimeout(function () {
      // complete
      wx.hideNavigationBarLoading() //完成停止加载
      wx.stopPullDownRefresh() //停止下拉刷新
    }, 1500);
  },

  // 加载
  onReachBottom: function () {
    // Do something when page reach bottom.
    console.log('circle 下一页');
    setTimeout(() => {
      this.setData({
        isHideLoadMore: true,
        goodsItems: this.data.goodsItems.concat([
          {
            offerid: 0,
            name: '木耳',
            url: 'bill',
            imageurl: 'http://www.360zn.xin/image/muer.png',
            newprice: "45.00",
            oldprice: "50.00",
            shiyong: 120,
          }
        ])
      })
    }, 1000)
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
